package com.ymatou.promotion.api.service;

import org.json.JSONObject;

import com.ymatou.promotion.api.parameter.GetCouponsByBatchCodeData;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*获取批次中的优惠券列表接口Call
*FreeMaker Template自动生成代码
*/
public class GetCouponsByBatchCodeCall extends YmatouBaseCall{
	private static String opurl ="api/Coupon/GetCouponsByBatchCode";
	
	public GetCouponsByBatchCodeCall() {
		super(EnvSetup.getSystemUrl("promition_api_coupon"),opurl,"GET","PARAM");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BCode
	 * 
	 * @return
	 */
	public String getBCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("BCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取Data
	 * 
	 * @return
	 */
	public String getData() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取MessageText
	 * 
	 * @return
	 */
	public String getMessageText() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("MessageText");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取BatchCode
	 * 
	 * @return
	 */
	public String getBatchCode1() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("BatchCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取CouponName
	 * 
	 * @return
	 */
	public String getCouponName() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("CouponName");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取MaxSendNum
	 * 
	 * @return
	 */
	public String getMaxSendNum() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("MaxSendNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取ReceiveNum
	 * 
	 * @return
	 */
	public String getReceiveNum() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("ReceiveNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取UsedNum
	 * 
	 * @return
	 */
	public String getUsedNum() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("UsedNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取ValidBegin
	 * 
	 * @return
	 */
	public String getValidBegin1() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("ValidBegin");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取ValidEnd
	 * 
	 * @return
	 */
	public String getValidEnd1() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("ValidEnd");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取InvalidTime
	 * 
	 * @return
	 */
	public String getInvalidTime() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("InvalidTime");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取InvalidStatus
	 * 
	 * @return
	 */
	public String getInvalidStatus() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("InvalidStatus");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	
	
	/**
	 * 获取Totals
	 * 
	 * @return
	 */
	public String getTotals() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("Totals");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}	

	/**
	 * 获取CouponDetails
	 * 
	 * @return
	 */
	public String getCouponDetails() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("CouponDetails").replace("[", "").replace("]", "");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponCode
	 * 
	 * @return
	 */
	public String getCouponCode() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("CouponCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取BatchCode
	 * 
	 * @return
	 */
	public String getBatchCode2() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("BatchCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取MinOrderAmount
	 * 
	 * @return
	 */
	public String getMinOrderAmount() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("MinOrderAmount");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponValue
	 * 
	 * @return
	 */
	public String getCouponValue() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("CouponValue");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponType
	 * 
	 * @return
	 */
	public String getCouponType() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("CouponType");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponUseType
	 * 
	 * @return
	 */
	public String getCouponUseType() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("CouponUseType");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取PlatformType
	 * 
	 * @return
	 */
	public String getPlatformType() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("PlatformType");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取ValidBegin
	 * 
	 * @return
	 */
	public String getValidBegin2() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("ValidBegin");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取ValidEnd
	 * 
	 * @return
	 */
	public String getValidEnd2() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("ValidEnd");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取Remainder
	 * 
	 * @return
	 */
	public String getRemainder() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("Remainder");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponState
	 * 
	 * @return
	 */
	public String getCouponState() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("CouponState");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取UserId
	 * 
	 * @return
	 */
	public String getUserId() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("UserId");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取UserName
	 * 
	 * @return
	 */
	public String getUserName() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("UserName");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CreateType
	 * 
	 * @return
	 */
	public String getCreateType() {
		String Code = null;
		try {
			Code = new JSONObject(getCouponDetails()).getString("CreateType");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	public GetCouponsByBatchCodeData getCouponsByBatchCodeData() {
		GetCouponsByBatchCodeData data = null;
		try {
			data = (GetCouponsByBatchCodeData) FormatUtil.GSONToObject(getData(), GetCouponsByBatchCodeData.class);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return data;
	}
}